DEBUG = 0

CC65_LIB = .
clflags = -c -g -tc64 -Oirs $(inc) -D DEBUG=$(DEBUG) -l -Wa-I.\datafiles
ccflags = -g -tc64 -Oirs $(inc) -D DEBUG=$(DEBUG) -l -Wa-I.\datafiles
ldflags = -C report.cfg
caflags = -tc64 -g -l -D DEBUG=$(DEBUG) $(inc)
exoflags = 0x080d -n -m 2048 -p 2
lib = ..\..\lib
libsrc = ..\..\libsrc
inc = -I. -I.\datafiles\ -I.\subs\ -I.\randfade \
					-I$(CC65_INC)\..\libsrc\c64


datafiles = datafiles\logoscrram.dat datafiles\logocolram.dat \
						datafiles\bitmap.dat datafiles\text.dat \
						datafiles\colors.dat datafiles\MC_GYVER.SCR \
						datafiles\RYK.SCR datafiles\TB.SCR \
						datafiles\KENCHIS.SCR \
						datafiles\BACCY.SCR datafiles\BUGJAM.SCR \
						datafiles\JAKTRIP.SCR datafiles\SCORPE.SCR \
						datafiles\MC_GYVER.COL \
						datafiles\RYK.COL datafiles\TB.COL \
						datafiles\KENCHIS.COL \
						datafiles\BACCY.COL datafiles\BUGJAM.COL \
						datafiles\JAKTRIP.COL datafiles\SCORPE.COL \
						datafiles\seperator.SCR

objects = report.o \
					randfade\randfade.o \
					data.o subs\copchar.o subs\copallchars.o \
					subs\coptxt2bmap.o \
					
headers = report.h

#.PHONY : all
all: report.run report.d64

data.o: data.s $(datafiles) results.s resultscolors.s
	ca65 $(caflags) $<

c64.lib: crt0.s
	ca65 $(caflags) $<
	ar65 a c64.lib crt0.o
	
report.run: main.c report.cfg c64.lib $(objects) $(headers) 
#ld65 $(ldflags) $(objects) $(CC65_LIB)\c64.lib -o $@ 
	cl65 $(clflags) $< -o main.o
	ld65 -C report.cfg crt0.o main.o $(objects) $(CC65_LIB)\c64.lib -o report.run
	
report.d64: report.run
	c1541 -format report,09 d64 $@ -write $<

report.exo: report.run
	exomizer $(exoflags) $< -o $@
%.o: %.c
	cl65 $(clflags) $<
	
%.o: %.s
	ca65 $(caflags) $<
	
#.PHONY: clean
clean :
	erase /s *.o
	
#.PHONY : cleanlst
cleanlst :
	erase *.lst
	